package com.sound.ampache;

/* Copyright (c) 2010 Brian Kirkman <kirkman.brian@gmail.com>
*
* +------------------------------------------------------------------------+
* | This program is free software; you can redistribute it and/or          |
* | modify it under the terms of the GNU General Public License            |
* | as published by the Free Software Foundation; either version 3         |
* | of the License, or (at your option) any later version.                 |
* |                                                                        |
* | This program is distributed in the hope that it will be useful,        |
* | but WITHOUT ANY WARRANTY; without even the implied warranty of         |
* | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          |
* | GNU General Public License for more details.                           |
* |                                                                        |
* | You should have received a copy of the GNU General Public License      |
* | along with this program; if not, write to the Free Software            |
* | Foundation, Inc., 59 Temple Place - Suite 330,                         |
* | Boston, MA  02111-1307, USA.                                           |
* +------------------------------------------------------------------------+
*
* Special thanks to the following: 
* Kevin Purdy, author of Amdroid, for much of the code used in this project
* 
* Jorge Ramon, author of MiamiCoder blog, for many great BlackBerry examples
* published on his blog.
* 
* 
*/

import net.rim.device.api.system.RadioInfo;

/**
 * Some static utility methods which may be useful for applications which 
 * make HTTP connections. 
 * @author Adam Rogers, Wireless Solutions Archetect, Research In Motion
 * @version %I%, %G%
 */
public class TransportUtils {
    
    /**
     * true if the device is able to send and receive <bold>data</bold>
     * @return   <code>true</code> if the handheld can make http connections;
     *           <code>false</code> otherwise.
     */
    public static boolean isInCoverage(){
        
        int service = RadioInfo.getNetworkService();
        if ((service & RadioInfo.NETWORK_SERVICE_DATA) == RadioInfo.NETWORK_SERVICE_DATA){
            int level = RadioInfo.getSignalLevel();
            if (level != RadioInfo.LEVEL_NO_COVERAGE){
                return true;
            }
        }
        return false;        
    }    
    
     /**
     * true if the device is on the iDEN network.  Otherwise false
     * @return   <code>true</code> if the handheld is iDEN based
     *           <code>false</code> otherwise.
     */
    public static boolean isDevicesideRequired(){
        int service = RadioInfo.getNetworkType();
        if (service == RadioInfo.NETWORK_IDEN) {
                return true;
        }
        return false;
    } 
         
}

